package chapter02

object Test03_Variable {
  def main(args: Array[String]): Unit = {
    //字符串通过+号连接


    val name: String = "alice"
    val age: Int = 18

    println(age + "岁的" + name + "在尚硅谷学习")


    //*用于将一个字符串复制多次拼接
    println(name * 3)

    //(2) printf 用法：字符串，通过%传值
    printf("%d岁的%s在尚硅谷学习", age, name)
    println()

    //(3) 字符串模板 （插值字符串）：通过$获取变量值
    println(s"${age}岁的${name}在尚硅谷学习")


    //2.2f  .2 是保留小数点前两位
    var num: Double = 2.3456
    println(f"The num is ${num}%2.2f")


    //原封不动的输出
    println(raw"The num is ${num}%2.2f")


    var sql =
      s"""
         |select *
         |from
         |student
         |where
         |name ="湛山"
         |""".stripMargin

    println(sql)

  }


}
